<?php

namespace app\admin\model\dahuinew;

use think\Model;

class Dljzmonth extends Model
{
    // 表名
    protected $name = 'dahuinew_dljzmonth';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    
    // 追加属性
    protected $append = [
        'sbzt_text',
        'zczt_text'
    ];
    

    
    public function getSbztList()
    {
        return ['未办理' => __('未办理'),'已办理' => __('已办理')];
    }     

    public function getZcztList()
    {
        return ['未办理' => __('未办理'),'已办理' => __('已办理')];
    }     


    public function getSbztTextAttr($value, $data)
    {        
        $value = $value ? $value : (isset($data['sbzt']) ? $data['sbzt'] : '');
        $list = $this->getSbztList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getZcztTextAttr($value, $data)
    {        
        $value = $value ? $value : (isset($data['zczt']) ? $data['zczt'] : '');
        $list = $this->getZcztList();
        return isset($list[$value]) ? $list[$value] : '';
    }




    public function dljzyw()
    {
        return $this->belongsTo('Dljzyw', 'dljzyw_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }
}
